package com.minisoft.utils;

import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONUtil;
import org.apache.rocketmq.acl.common.AclClientRPCHook;
import org.apache.rocketmq.acl.common.SessionCredentials;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.RPCHook;
import org.junit.Test;

import java.nio.charset.StandardCharsets;
import java.util.List;

/**
 * @author JueSu
 * @description: TODO
 * @date 2021/11/1 10:33
 */
public class RocketMQTest {
    private String namesrvAddr = "172.16.57.154:9876;172.16.57.153:9876";
    private String producerGroup = "gfMasterDataGroupDev";
    private String topic = "gfYdacTopicDev";
    private String tag = "";
    private String accessKey = "gf-rs-rushi";
    private String secretKey = "1234567";

//    private String namesrvAddr = "172.16.58.76:9876;172.16.58.77:9876";
//    private String producerGroup = "syncCustomerCenterDataGroupPro";
//    private String topic = "syncCustomerCenterDataTopicPro";
//    private String tag = "";
//    private String accessKey = "gf-rs-rushi";
//    private String secretKey = "1swaa4fffgr4";
    private DefaultMQProducer producer;

    private RPCHook getAclRPCHook() {
        return new AclClientRPCHook(new SessionCredentials(accessKey, secretKey));
    }

    @Test
    public void testSendTodo() throws Exception {
        producer = new DefaultMQProducer(producerGroup, getAclRPCHook());
        producer.setNamesrvAddr(namesrvAddr);
        producer.start();
        Message message = new Message();
        message.setTopic("gfYdacTopicDev");
        message.setTags("ydacTodoCenter");
        String bodyStr ="{\"todoType\":4,\"action\":0,\"saleTeamId\":\"1000118\",\"title\":\"张三\",\"mobile\":\"13800138000\",\"channel\":\"置业通小程序\",\"targetId\":\"bc6f03c3938f49488632a26198372f8c\",\"userkey\":\"CHENJUESU\",\"subTitle1\":\"2022-01-27 10:26:48\"}";
        bodyStr = "{\"todoType\":1,\"targetId\":\"159241\",\"mobile\":\"14318181144\",\"saleTeamId\":\"1119001\",\"channel\":\"天猫好房\",\"title\":\"测试数据四1\",\"userkey\":\"ZHENG.SHAOMING\",\"action\":0}";
        message.setBody(bodyStr.getBytes(StandardCharsets.UTF_8));
        for (int i = 0; i < 10; i++) {
            producer.send(message);
        }
    }

    @Test
    public void testSendBuildingInfo() throws Exception {
        producer = new DefaultMQProducer(producerGroup, getAclRPCHook());
        producer.setNamesrvAddr(namesrvAddr);
        producer.start();
        Message message = new Message();
        message.setTopic("gfMasterDataTopicDev");
        message.setTags("buildingInfo");
        String bodyStr ="{\"todoType\":4,\"action\":0,\"saleTeamId\":\"1000118\",\"title\":\"张三\",\"mobile\":\"13800138000\",\"channel\":\"置业通小程序\",\"targetId\":\"bc6f03c3938f49488632a26198372f8c\",\"userkey\":\"CHENJUESU\",\"subTitle1\":\"2022-01-27 10:26:48\"}";
//        bodyStr = "{\"saleOrgId\":\"1058\",\"unitPrice\":\"38000\",\"unitPriceTail\":\"元/㎡\",\"totalPrice\":\"300\",\"totalPriceTail\":\"万元/套\",\"parkingPrice\":\"30\",\"parkingPriceTail\":\"万元/个\",\"houseStatus\":\"房源在售\",\"parkingStatus\":\"车位在售\",\"buildingTypeText\":\"高层住宅\",\"propertyTypeText\":\"住宅\",\"bookDate\":\"2023-08-29\",\"propertyYears\":\"70年\"}";
        bodyStr = "{\"hfProjectId\":\"00000037\",\"saleOrgId\":\"1272\",\"unitPrice\":\"16369\",\"bookDate\":\"2019-12-28\",\"propertyYears\":\"72年\",\"houseStatus\":\"房源在售\",\"totalPrice\":\"168\",\"parkingPriceTail\":\"万元/个\",\"propertyTypeText\":\"住宅P\",\"buildingTypeText\":\"住宅-超高层\",\"totalPriceTail\":\"万元/套\",\"unitPriceTail\":\"元/㎡\"}";
        message.setBody(bodyStr.getBytes(StandardCharsets.UTF_8));
        producer.send(message);
    }
    @Test
    public void testSendScan() throws Exception {
        producer = new DefaultMQProducer(producerGroup, getAclRPCHook());
        producer.setNamesrvAddr(namesrvAddr);
        producer.start();
        Message message = new Message();
        message.setTopic("gfOneCodeScaneTopicDev");
        message.setTags("oneCode");
        String bodyStr ="{\"openId\":\"oiaXF5EZR26KkE4tbS-4I9WFoVh4\",\"scanTime\":1644891881935,\"typeCode\":\"1\",\"scene\":\"f444dfbe30c14c939dfcb2e64706355d\",\"codeId\":2463,\"sceneCode\":\"3\",\"codeName\":\"测试地图找房\"}";
        message.setBody(bodyStr.getBytes(StandardCharsets.UTF_8));
        producer.send(message);
    }
    @Test
    public void testSend() throws Exception {
        producer = new DefaultMQProducer(producerGroup, getAclRPCHook());
        producer.setNamesrvAddr(namesrvAddr);
        producer.start();
        Message message = new Message();
        message.setTopic(topic);
        message.setTags(tag);
        String bodyStr = "{\"action\":\"inform\",\"params\":{\"customerAllocationDto\":{\"customerName\":\"卡瓦莎\",\"gender\":0},\"customerMobile\":\"18788876567\",\"customerOpportunityId\":\"\",\"reportId\":\"df81030c9cd944aaa897365e7a103ed9\",\"saleMainId\":\"YANGYUE1\",\"saleMainMobile\":\"13809230053\",\"saleTeamId\":\"1000118\",\"updateId\":\"chenjuesu\"},\"saleTeamSaleOrgRel\":[\"1012\"]}";
//        bodyStr = "{\"action\":\"inform\",\"params\":{\"customerAllocationDto\":{\"customerName\":\"珠海测试07\",\"gender\":2},\"customerMobile\":\"18800045606\",\"customerOpportunityId\":\"\",\"reportId\":\"fda60cbfe258412b8637600536ed3f06\",\"saleMainId\":\"YIHUAN\",\"saleMainMobile\":\"15914420853\",\"saleTeamId\":\"1000118\",\"updateId\":\"pangandi\"},\"saleTeamSaleOrgRel\":[\"1012\"]}";
//        bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"测试报备\",\"gender\":1},\"mobile\":\"13800000002\",\"reportId\":\"3ec39745c81e4cc0ac6caa9b4bd039b9\",\"saleMainId\":\"PANGANDI\",\"saleTeamId\":\"1000118\",\"type\":0,\"updateId\":\"pangandi\"},\"saleTeamSaleOrgRel\":[\"1012\"],\"userIds\":[]}";

//        bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"季朝明\",\"gender\":0},\"mobile\":\"13735396116\",\"reportId\":\"2c9000487ca23e11017ccec45e487c12\",\"saleMainId\":\"XUHUAYAN\",\"saleTeamId\":\"1000026\",\"type\":0,\"updateId\":\"chenyangchun\"},\"saleTeamSaleOrgRel\":[\"1124\",\"1165\"],\"userIds\":[]}";
//        bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"孙利珍\",\"gender\":1},\"mobile\":\"17769859736\",\"reportId\":\"257faed8266a4d079324052ec99ca712\",\"saleMainId\":\"CHENLU2\",\"saleTeamId\":\"1000026\",\"type\":0,\"updateId\":\"chenyangchun\"},\"saleTeamSaleOrgRel\":[\"1124\",\"1165\"],\"userIds\":[]}";
//        bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"霍玉衡\",\"gender\":0},\"mobile\":\"18107468229\",\"reportId\":\"9b6f7639db9b40998b1717194fd30c0b\",\"saleMainId\":\"TANGMEIJIE\",\"saleTeamId\":\"1000026\",\"type\":0,\"updateId\":\"chenyangchun\"},\"saleTeamSaleOrgRel\":[\"1124\",\"1165\"],\"userIds\":[]}";
//        bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"郭加莲\",\"description\":\"\",\"gender\":1},\"mobile\":\"16675155912\",\"reportId\":\"\",\"saleMainId\":\"ZHANG.JING1\",\"saleTeamId\":\"1000094\",\"type\":0,\"updateId\":\"yangmeng\"},\"saleTeamSaleOrgRel\":[\"1016\"],\"userIds\":[\"c151888d221b425fb727b17457ea5fd6\"]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"\",\"ageStageName\":\"\",\"buyfactor\":\"户型\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-11-05 14:10:15\"]],\"customerName\":\"郭加莲\",\"customerOpportunityId\":\"abf7a33cb88a40a39194a112287709fc\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":1,\"idCardNo\":\"R252121(A)\",\"idCardType\":\"港澳台身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"16675155912\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"ZHANG.JING1\",\"saleOrgId\":\"1016\",\"targetAcreageName\":\"\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"自然到访\",\"visitFirstDate\":1636092615000,\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1016\"]}";
//        bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"刘璐明\",\"gender\":0},\"mobile\":\"13942029789\",\"reportId\":\"8c007602952d4795adc07b27d91c9231\",\"saleMainId\":\"CHENXIAOYU5\",\"saleTeamId\":\"1000004\",\"type\":0,\"updateId\":\"kangweini\"},\"saleTeamSaleOrgRel\":[\"1117\"],\"userIds\":[]}";
//        bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"刘璐明\",\"gender\":0},\"mobile\":\"13942029789\",\"reportId\":\"9226373c49dc4a6c8391cd54b9ba3a13\",\"saleMainId\":\"CHENXIAOYU5\",\"saleTeamId\":\"1000005\",\"type\":0,\"updateId\":\"kangweini\"},\"saleTeamSaleOrgRel\":[\"1122\"],\"userIds\":[]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"\",\"ageStageName\":\"\",\"buyfactor\":\"户型,产品\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-11-05 16:03:01\"]],\"customerName\":\"刘璐明\",\"customerOpportunityId\":\"b9ca89cdbf9b4a73bc8f10290dfd5611\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":0,\"idCardNo\":\"\",\"idCardType\":\"\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"13942029789\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"价格太高,路段太偏,配套设施不完善\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"CHENXIAOYU5\",\"saleOrgId\":\"1117\",\"targetAcreageName\":\"\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"机构推荐\",\"visitFirstDate\":1636099381000,\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1117\"]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"广东省电白县电城镇东街15号\",\"ageStageName\":\"\",\"buyfactor\":\"\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-11-06 11:32:11\"]],\"customerName\":\"陈广辉\",\"customerOpportunityId\":\"2c90006a7ca23ff6017ca5bafe072250\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":0,\"idCardNo\":\"440923199101020278\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"15019917056\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"ZHENGYONGMIN\",\"saleOrgId\":\"1099\",\"targetAcreageName\":\"\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"机构推荐\",\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1099\"]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"\",\"ageStageName\":\"\",\"buyfactor\":\"\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-11-06 10:50:44\"],[\"1004002\",\"来访\",\"2021-11-06 11:32:26\"]],\"customerName\":\"杨斯哲\",\"customerOpportunityId\":\"55928ddf5d03466abb01f7925e7f0f51\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":1,\"idCardNo\":\"440981199303175669\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"15915280560\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"ZHENGYONGMIN\",\"saleOrgId\":\"1099\",\"targetAcreageName\":\"\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"机构推荐\",\"visitFirstDate\":1636167044000,\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1099\"]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"广东省中山市东区维景湾6座301\",\"ageStageName\":\"\",\"buyfactor\":\"\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-11-05 10:05:31\"]],\"customerName\":\"陈彬\",\"customerOpportunityId\":\"cd6540ef8dfb427c8341e6d88f009af6\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":0,\"idCardNo\":\"445121199801133917\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"13112952243\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"HUANGHUAJIAN\",\"saleOrgId\":\"1099\",\"targetAcreageName\":\"\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"机构推荐\",\"visitFirstDate\":1636077931000,\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1099\"]}";
//       bodyStr = "{\"action\":\"saleAllocation\",\"params\":{\"clueType\":1,\"customerAllocationDto\":{\"customerName\":\"清风是狗\",\"gender\":0},\"mobile\":\"14380583298\",\"reportId\":\"ddf2598d5db04021885b9ad11c023b7a\",\"saleMainId\":\"CHEN.SIYU\",\"saleTeamId\":\"1000114\",\"type\":0,\"updateId\":\"zhangfeng\"},\"saleTeamSaleOrgRel\":[\"1018\",\"1019\",\"1057\",\"1058\",\"1158\",\"1159\"],\"userIds\":[]}";
//       bodyStr = "{\"action\":\"inform\",\"params\":{\"customerAllocationDto\":{\"customerName\":\"杨书娇\",\"gender\":1},\"customerMobile\":\"15995580756\",\"customerOpportunityId\":\"\",\"reportId\":\"8ee0627d4e004684af3721e324523a0a\",\"saleMainId\":\"JINQIANQIAN\",\"saleMainMobile\":\"13962415922\",\"saleTeamId\":\"1000038\",\"updateId\":\"yujing2\"},\"saleTeamSaleOrgRel\":[\"1168\"]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"江苏省太仓市娄东街道景湖花苑四园8幢106室\",\"ageStageName\":\"\",\"buyfactor\":\"\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-11-30 16:40:30\"]],\"customerName\":\"杨书娇\",\"customerOpportunityId\":\"006fa10c96da4ae497032a1d28489b7f\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":1,\"idCardNo\":\"412822197602014824\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"15995580756\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"JINQIANQIAN\",\"saleOrgId\":\"1168\",\"targetAcreageName\":\"\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"拓客团队推荐\",\"visitFirstDate\":1638261630000,\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1168\"]}";
//       bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"浙江省绍兴市越城区北海路5号1幢323室\",\"ageStageName\":\"46-50\",\"buyfactor\":\"户型\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"中介信息\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-12-01 14:40:26\"]],\"customerName\":\"陈彬\",\"customerOpportunityId\":\"c1e45f8b64cd4131bfa5936851dad4d4\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"一胎家庭\",\"gender\":1,\"idCardNo\":\"320303197604203629\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"越城-城北\",\"mobile\":\"15967553068\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"价格太高\",\"opportunityState\":2,\"professionName\":\"其他\",\"propcondition\":\"\",\"saleMainId\":\"WANGXINLI\",\"saleOrgId\":\"1124\",\"targetAcreageName\":\"75㎡以下\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"自住\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"其他\",\"userrank\":\"A类\",\"vehicleName\":\"\",\"visitChannelName\":\"机构推荐\",\"visitFirstDate\":1638340826000,\"workAreaName\":\"越城-城北\"},\"saleTeamSaleOrgRel\":[\"1124\",\"1165\"]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"\",\"ageStageName\":\"\",\"buyfactor\":\"\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-12-01 20:42:53\"]],\"customerName\":\"谢作友\",\"customerOpportunityId\":\"4d52cb5e7e52447682e32946059ab0d7\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":0,\"idCardNo\":\"330323196902285936\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"13506671117\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"GUODENGFENG\",\"saleOrgId\":\"1018\",\"targetAcreageName\":\"\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"自然到访\",\"visitFirstDate\":1638362573000,\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1018\",\"1019\",\"1057\",\"1058\",\"1158\",\"1159\"]}";
//        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"\",\"ageStageName\":\"46-50\",\"buyfactor\":\"户型,品牌,地段\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"朋友介绍\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-12-01 14:31:23\"]],\"customerName\":\"龚小姐\",\"customerOpportunityId\":\"c4d408dd4c9c4e108086933ffdd314b0\",\"description\":\"一个女的50岁左右，挺有气质的，清远人，粤省事显示在广州，考虑给孩子买房子住，一次性，最晚下周会有回复，自己做主，朋友在澳门，对珠海很熟悉，很喜欢，126的推荐他过来看房的，转的三栋502，表示最低可以申请93折\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"1小孩\",\"gender\":1,\"idCardNo\":\"\",\"idCardType\":\"\",\"isImportant\":\"0\",\"isLimitedBuy\":\"否\",\"isLimitedLoan\":\"否\",\"liveplate\":\"\",\"mobile\":\"13553911108\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"路段太偏,配套设施不完善,交楼晚\",\"opportunityState\":2,\"professionName\":\"私营业主\",\"propcondition\":\"第一套\",\"saleMainId\":\"PANG.FANG\",\"saleOrgId\":\"1170\",\"targetAcreageName\":\"128㎡\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"自住\",\"targetTotalPriceName\":\"351-400万\",\"targetUnitPriceName\":\"2.7-2.8万\",\"tradeName\":\"\",\"userrank\":\"D类\",\"vehicleName\":\"\",\"visitChannelName\":\"自然到访\",\"visitFirstDate\":1638340283000,\"workAreaName\":\"省内其他城市\"},\"saleTeamSaleOrgRel\":[\"1170\"]}";
        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"\",\"ageStageName\":\"31-35\",\"buyfactor\":\"开发商品牌\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"代理商介绍\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-12-02 13:38:38\"]],\"customerName\":\"柯丹\",\"customerOpportunityId\":\"f6e7d10610ed48aa9cb9bd1f3b0a2046\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":1,\"idCardNo\":\"360730199111050027\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"否\",\"isLimitedLoan\":\"否\",\"liveplate\":\"\",\"mobile\":\"18981740607\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"价格太高\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"YINLINGLING\",\"saleOrgId\":\"1162\",\"targetAcreageName\":\"150㎡以上\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"自住\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"A：高意向度-会认购\",\"vehicleName\":\"\",\"visitChannelName\":\"机构推荐\",\"visitFirstDate\":1638423518000,\"workAreaName\":\"华南\"},\"saleTeamSaleOrgRel\":[\"1022\",\"1065\",\"1116\",\"1136\",\"1138\",\"1161\",\"1162\",\"1172\",\"1174\",\"1177\"]}";
        bodyStr = "{\"action\":\"updateCustomer\",\"params\":{\"address\":\"\",\"ageStageName\":\"21-35岁\",\"buyfactor\":\"\",\"carBrandName\":\"\",\"carParkName\":\"\",\"channelWayName\":\"灯箱-机场灯箱\",\"contactTypeName\":\"来访\",\"customerFollow\":[[\"1004002\",\"来访\",\"2021-12-02 11:24:55\"]],\"customerName\":\"徐建花\",\"customerOpportunityId\":\"2c90ba64797e7c1801797e9acfb606a5\",\"description\":\"\",\"educationName\":\"\",\"familyIncomeName\":\"\",\"familyMemberName\":\"\",\"gender\":1,\"idCardNo\":\"330821198101266704\",\"idCardType\":\"身份证\",\"isImportant\":\"0\",\"isLimitedBuy\":\"\",\"isLimitedLoan\":\"\",\"liveplate\":\"\",\"mobile\":\"18621823305\",\"mobile01\":\"\",\"mobile02\":\"\",\"notbuyreason\":\"\",\"opportunityState\":2,\"professionName\":\"\",\"propcondition\":\"\",\"saleMainId\":\"GUO.FANGHANG\",\"saleOrgId\":\"1018\",\"targetAcreageName\":\"1014003\",\"targetHouseTypeName\":\"\",\"targetObjectiveName\":\"投资兼自住\",\"targetTotalPriceName\":\"\",\"targetUnitPriceName\":\"\",\"tradeName\":\"\",\"userrank\":\"\",\"vehicleName\":\"\",\"visitChannelName\":\"拓客团队推荐\",\"workAreaName\":\"\"},\"saleTeamSaleOrgRel\":[\"1018\",\"1019\",\"1057\",\"1058\",\"1158\",\"1159\"]}";
        message.setBody(bodyStr.getBytes(StandardCharsets.UTF_8));
        producer.send(message);
    }

    @Test
    public void flushData() throws Exception {
        producer = new DefaultMQProducer(producerGroup, getAclRPCHook());
        producer.setNamesrvAddr(namesrvAddr);
        producer.start();
        List<String> msgs = FileUtil.readUtf8Lines(getClass().getResource("/fixMsg.txt"));
        int i = 1;
        for (String msg : msgs) {
            Message message = new Message();
            message.setTopic(topic);
            message.setTags(tag);
            System.out.println((i++) + ":" + JSONUtil.parseObj(msg));
            message.setBody(msg.getBytes(StandardCharsets.UTF_8));
            producer.send(message);
            Thread.sleep(5000);
        }
    }

    @Test
    public void sendCpDatra() throws Exception {
        producer = new DefaultMQProducer("gfCustomerPoolGroupDev", getAclRPCHook());
        producer.setNamesrvAddr("172.16.57.154:9876;172.16.57.153:9876");
        producer.start();
        for (int i = 0 ;i < 10 ;i++) {
            Message message = new Message();
            message.setTopic("customerPoolDev");
            message.setTags("cpUserMpQueue");
            String msg = "{\"eventId\":\"ProjectView\",\"dataDate\":1636446869782,\"unionId\":\"oAzsdt6Hr956rG89kN9P97cVddzo\",\"pageId\":66458,\"appType\":1,\"eventName\":\"\"}";
            message.setBody(msg.getBytes(StandardCharsets.UTF_8));
            producer.send(message);
        }
    }
}
